<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        div{
            width: 200px;
            height: 200px;
            border: 1px solid red;
        }
        li{
            list-style: none;
            text-align: center;
        }
        .uul1{
            display: flex;
        }
        .uul1 li{
            height: 40px;
            background: rgb(138, 74, 74);
            flex: 1;
            line-height: 40px;
            border: 1px solid rgb(164, 14, 14);
            user-select: none;
            cursor: pointer;
        }
        .uul2{
            position: relative;
        }
        .uul2 p{
            width: 200px;
            height: 158px;
            font-size: 80px;
            line-height: 158px;
            position: absolute;
            display: none;
            text-align: center;
        }
        .uul2 p:nth-of-type(1){
            background: rgb(22, 154, 28);
        }
        .uul2 p:nth-of-type(2){
            background: rgb(29, 9, 94);
        }
        .uul2 p:nth-of-type(3){
            background: rgb(154, 22, 103);
        }
        .as{
            background-color: blue !important;
            color: azure;
        }
    </style>
</head>
<body>
    <div>
        <ul class="uul1">
            <li>1</li>
            <li>2</li>
            <li>3</li>
        </ul>
        <ul class="uul2">
            <p>1</p>
            <p>2</p>
            <p>3</p>
        </ul>
    </div>
</body>
</html>
<script>
    const asd = document.querySelectorAll('li')
        asdd = document.querySelectorAll('p')
    asd.forEach(li =>{
        // console.log(li);
        li.onclick = () =>{
            // console.log(li);
            // li.classList.remove('as')
            asd.forEach(li => {
                li.classList.remove('as')
            })
            asdd.forEach(p => {
                // console.log(li);
                // console.log(p);
                p.style.display = 'none'
                if(li.innerText == p.innerText){
                    li.classList.add('as')
                    p.style.display = 'block'
                }
            })
        }
        // console.log(li)
    })
</script>